﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpDX;

namespace Omega.Game.Framework
{
    [Serializable()]
    public class Camera : Interfaces.IComponent
    {

        Transform _transform;
        Vector3 _up;
        Vector3 _lookAt;
        float _zoom;
        bool _ortho;
        float _min_view, _max_view;

        public float MinView { get { return _min_view; } set { _min_view = value; } }
        public float MaxView { get { return _max_view; } set { _max_view = value; } }
        public float Zoom { get { return _zoom; } set { _zoom = value; } }
        public bool Ortho { get { return _ortho; } set { _ortho = value; } }
        public Transform Transform { get { return this.Transform; } private set { Transform = value; } }
        public Vector3 Up { get { return _up; } }

        public Matrix GetViewMatrix()
        {
           return Matrix.LookAtLH(this.Transform.Position 
               , Transform.Rotation , new Vector3(0,1,0));
        }
        public Matrix GetProjectionMatrix()
        {
            return Matrix.PerspectiveFovLH(3.14f * 0.25f, (float)(Graphics.Widh / Graphics.Height) , this.MinView, this.MaxView);
        }

        public Interfaces.IComponent Parent
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }

        public void Init()
        {
            this.Transform = new Transform();
            this._transform.Position = new Vector3();
            this._transform.Rotation = new Vector3();
            this.MinView = 10f;
            this.MaxView = 50f;

        }

        public void Update()
        {
            if (this.Parent != null)
            {

            }

        }
        public void Dispose()
        {

        }
    }
}
